/* eslint-disable one-var */
'use strict'

var gulp = require('gulp'),
  del = require('del'),
  gulpLoadPlugins = require('gulp-load-plugins')

var $ = gulpLoadPlugins()

// var isPrd = process.env.VUE_ENV === 'prod'
var isPrd = false
var theme = process.env.NODE_THEME || 'default'

function cssWrap () {
  return gulp.src(`theme/css/${theme}/index.css`)
    .pipe($.cssWrap({ selector: `.skin-${theme}` }))
    .pipe($.if(isPrd, $.cleanCss()))
    .pipe(gulp.dest(`static/skins/${theme}`))
}

function fonts () {
  return gulp.src(`theme/css/${theme}/fonts/**/*.{eot,svg,ttf,woff,woff2}`)
    .pipe(gulp.dest(`static/skins/${theme}/fonts`))
}

function clean () {
  return del([])
}

var build = gulp.series(clean, gulp.parallel(cssWrap, fonts))

exports.default = build
